package com.hongshan.wallet

import android.os.Environment
import com.google.gson.Gson
import com.hongshan.wallet.core.WebActivity
import com.hongshan.wallet.core.comm.SendSmsActivity
import com.hongshan.wallet.core.comm.VerificationPwdActivity
import java.util.*

/**
 * Copyright Qiandai Ltd.
 * Copyright (c) 2019
 * All rights reserved
 *
 * @project  : Wallet
 * @package  : com.example.wallet
 * @author   : Administrator
 * @data     : 2019/3/18
 * @email    : zhangxx@baihang-china.com
 */
object Constant {

    val gson = Gson()

    object Regex {
        const val TEL = "[1][3-9]\\d{9}"
        const val SMS_VERIFY = "\\d{6}"
        const val PAY_PWD = "\\d{6}"
        const val EMAIL = "\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"
        const val PASSWORD = "(?!^\\d+\$)(?!^[a-zA-Z]+\$)[0-9a-zA-Z]{8,20}"
        const val ID_CARD = "[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}\$|^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9]|BindInfo)"
        const val BANK_CARD = "\\d{16}|\\d{19}"
    }
    object SdkID {
    }
    object SP{
        const val SP_NAME = "config"
        const val SP_KEY_LAST_RUN_VERSION = "last_run_version"
        const val SP_KEY_FIRST_GO_HOME = "first_go_home"
        const val SP_KEY_FIRST_BIND_WX = "first_bind_wx"
        const val SP_KEY_FIRST_BIND_ZFB = "first_bind_zfb"
    }
    object HttpApi {
        val HOST_URL = when (BuildConfig.ENV_TYPE) {
            1 -> "wallet.herbeauty.top/"
            else -> "swin.herbeauty.top/"
        }
        val BASE_URL = "https://$HOST_URL"

        val BASE_WEBSOCKET_URL = "wss://${HOST_URL}wss"
    }
    object RandomWord {
        val UUID_STR get() = UUID.randomUUID().toString().toLowerCase().replace("-", "")
    }
    object Time {
        const val SECOND = 1000L
        const val MINUTE = SECOND * 60
        const val HOUR = MINUTE * 60
        const val DAY = HOUR * 24
        const val WEEK = DAY * 7
    }
    object FileSize {
        const val B = 1L
        const val KB = B * 1024
        const val MB = KB * 1024
        const val GB = MB * 1024
    }

    object FilePath {
        val SDCARD = Environment.getExternalStorageDirectory().absoluteFile
        val DATA_PATH = "${Environment.getDataDirectory()}/data/${BuildConfig.APPLICATION_ID}"
        val APP_DATA_PATH = "$DATA_PATH/files/"
        var DATA_CACHE_FOLDER = "$DATA_PATH/cache/"
        val SDCARD_DOWNLOAD = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
        val LOG_PATH = "$SDCARD/log/"
    }

    object ROUTE_PARAMS_KEY{
        val SMS_TITLE = "${SendSmsActivity::class.java.simpleName}_title"
        val SMS_BUTTON = "${SendSmsActivity::class.java.simpleName}_button"
        val SMS_ACTION = "${SendSmsActivity::class.java.simpleName}_action"
        val SMS_NEXT_URL = "${SendSmsActivity::class.java.simpleName}_next_url"
        val SMS_NEED_FINISH = "${SendSmsActivity::class.java.simpleName}_need_finish"

        val VERFIFCATION_PWD_NEXT_URL = "${VerificationPwdActivity::class.java.simpleName}_next_url"
        val VERFIFCATION_PWD_IS_AGAIN = "${VerificationPwdActivity::class.java.simpleName}_is_again"
        val VERFIFCATION_PWD_NEED_AGAIN = "${VerificationPwdActivity::class.java.simpleName}_need_again"
        val VERFIFCATION_PWD_NEED_FINISH = "${VerificationPwdActivity::class.java.simpleName}_need_finish"
        val VERFIFCATION_PWD_FIRST_PWD = "${VerificationPwdActivity::class.java.simpleName}_first_pwd"
        val VERFIFCATION_PWD_TITLE = "${VerificationPwdActivity::class.java.simpleName}_title"
        val VERFIFCATION_PWD_DESC = "${VerificationPwdActivity::class.java.simpleName}_desc"
        val VERFIFCATION_PWD_DESC_AGAIN = "${VerificationPwdActivity::class.java.simpleName}_desc_again"
        val VERFIFCATION_ACTION = "${VerificationPwdActivity::class.java.simpleName}_action"
        val VERFIFCATION_BUTTON = "verification_pwd_activity_button"

        const val REAL_NAME_ACTION = "real_name_activity_action"
        const val REAL_NAME_NEXT_URL = "real_name_activity_next_url"
        const val REAL_NAME_NEED_FINISH = "real_name_activity_need_finish"
        const val REAL_NAME_NAME = "real_name_activity_name"
        const val REAL_NAME_ID_CARD = "real_name_activity_id_card"

        const val GUIDE_NEXT_URL = "activity_guide_next_url"
        const val GUIDE_IMAGE = "activity_guide_image_res"
//        const val GUIDE_IMAGE = "activity_guide_image_res"
        const val GUIDE_NEED_BUTTON = "activity_guide_need_button"

        val WEB_ACTION = "${WebActivity::class.java.simpleName}_action"

        const val PAY_PWD_VERIFY_CODE = "pay_password_verify_code"

        const val ACTION_ADD_BANK_CARD = "action_add_bank_card"
        const val ACTION_UNBIND_WX_OR_ALIPAY = "action_unbind_wx_or_alipay"
        const val ACTION_SET_PAY_PWD = "action_set_pay_pwd"
        const val ACTION_CHECK_PAY_PWD = "action_check_pay_pwd"
        const val ACTION_MY_INVITE = "action_my_invite"
        const val ACTION_CHECK_REAL_NAME = "action_check_real_name"
        const val ACTION_SET_REAL_NAME = "action_set_real_name"
        const val ACTION_LOOK_REAL_NAME = "action_look_real_name"

        const val ORDER_ID = "order_id"
        const val TRADING_ALERT = "trading_alert"
        const val ACTIVITY_FLAG = "activity_flag"
        const val PARAM_ACCOUNT_TYPE = "PARAM_ACCOUNT_TYPE"
        const val PARAM_REAL_NAME = "PARAM_REAL_NAME"
        const val PARAM_ID_CARD = "PARAM_ID_CARD"

        const val BIND_ACCOUNT_TYPE = "bind_account_type"
        const val BIND_ACCOUNT_DATA = "bind_account_data"
        const val BIND_ACCOUNT_DATA_BANKCARD = "bind_account_data_bankcard"

        const val TOP_UP_PAY_METHOD = "top-up-pay-method"
    }

    object OTHER_CONFIG{
        const val ROWS = 10
    }
}